﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using TongCheng.API.OpenAPI.Request;
using TongCheng.API.OpenAPI.Util;

namespace TongCheng.API.OpenAPI
{
    public class DefaultTcClient : ITcClient
    {
        private WebUtils webUtils;

        public DefaultTcClient()
        {
            webUtils = new WebUtils();
        }

        public string Execute(ITcRequest request)
        {
            // 提前检查业务参数
            try
            {
                request.Validate();
            }
            catch (TcException e)
            {
            }

            string body;
            body = webUtils.DoPost(request.GetServerUrl(), request);


            return body;
        }
    }
}
